package main

import (
	"Comments/pkg/api"
	"Comments/pkg/db/postgresql"
	"log"
	"net/http"
	"os"
)

func main() {
	// Create a new db instance
	constr := os.Getenv("COMSDB")
	db, err := postgresql.New(constr)
	if err != nil {
		log.Fatal(err)
	}
	// Create a new API instance
	api := api.New(db)
	// Create a new rout
	err = http.ListenAndServe(":23456", api.Router())
	if err != nil {
		log.Fatal(err)
	}
}
